﻿using System;
using System.Collections.Generic;
using System.IO;
using CSJ2K.Util.IO;

namespace CSJ2K.Jpc.Segments
{
    /// <summary>Start of codestream (SOC)</summary>
    /// <comment>
    /// Function: Marks the beginning of a codestream specified in this Recommendation 
    ///      | International Standard. 
    /// Usage: Main header. This is the first marker in the codestream. There shall be 
    ///      only one SOC per codestream. 
    /// Length: Fixed.
    /// </comment>
    public class SOC : Segment
    {
        public SOC(Stream source)
            : this(source, (Markers)StreamUtil.ReadBUInt16(source)) { }
        public SOC(Stream source, Markers marker)
            : base(source, marker, false)
        {
            if (marker != Markers.SOC) throw (new ApplicationException("Attempting to create segment of the wrong type."));

        }
    }
}
